/**
 * Project Name:kany-project-spring-boot
 * File Name:VelocityConfig.java
 * Package Name:me.kany.project.spring.boot.config
 * Date:2016年5月10日下午6:10:45
 * Copyright (c) 2016, Jason.Wang All Rights Reserved.
 *
*/

package me.kany.project.spring.boot.config.velocity;

import org.springframework.boot.autoconfigure.velocity.VelocityProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.view.velocity.VelocityViewResolver;

/**
 * ClassName:VelocityConfig <br/>
 * Function: 提供一个Velocity的配置类. <br/>
 * Date: 2016年5月10日 下午6:10:45 <br/>
 * 
 * @author Jason.Wang
 * @version
 * @since JDK 1.7
 * @see
 */
@SuppressWarnings("deprecation")
@Configuration
public class VelocityConfig {
	@Bean
	// 现在这个class不再是layout的，所以要把对应的 ViewResolver改成对应的，由于没有
	// toolboxviewresolver，就用父类 veclotiyviewresoler
	public VelocityViewResolver velocityViewResolver(VelocityProperties properties) {
		VelocityViewResolver viewResolver = new VelocityViewResolver();
		viewResolver.setViewClass(VelocityLayoutToolboxView.class);
		properties.applyToViewResolver(viewResolver);// 设置默认属性，比如前缀和后缀
		return viewResolver;
	}
}
